<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/

Route::pattern('id', '[0-9]+');

Route::get('/', function()
{
	return View::make('hello');
});

//新闻
Route::get('news','news\IndexController@index');
Route::get('news/{id}','news\IndexController@detail');

//项目
Route::get('project','project\IndexController@index');
Route::get('project/{id}','project\IndexController@detail');

//用户注册登录相关
Route::get('user/login','user\IndexController@login');
Route::post('user/dologin','user\IndexController@doLogin');
Route::get('user/register','user\IndexController@register');
Route::post('user/doregister','user\IndexController@doRegister');

Route::group(array('prefix'=>'user','before'=>'auth'),function(){
    //用户主页
    Route::get('index', 'user\IndexController@index');
    Route::get('logout','user\IndexController@logout');
    Route::get('resetpassword','user\IndexController@resetPassword');
    Route::post('doresetpassword','user\IndexController@doResetPassword');

    //用户管理
    Route::get('user/avatar','user\UserController@avatar');
    Route::post('user/doavatar','user\UserController@doAvatar');
    Route::get('user/profile','user\UserController@profile');
    Route::post('user/doprofile','user\UserController@doProfile');


    //用户留言
    Route::get('message','user\MessageController@index');
    Route::get('message/lists/{id}','user\MessageController@lists');
    Route::get('message/send','user\MessageController@send');
    Route::post('message/dosend','user\MessageController@doSend');
    Route::post('message/clear','user\MessageController@clear');

    //开源项目管理
    Route::get('projects/add','user\ProjectsController@add');
    Route::post('projects/doadd','user\ProjectsController@doAdd');
    Route::get('projects/modify/{id}','user\ProjectsController@modify');
    Route::post('projects/domodify','user\ProjectsController@doModify');
    Route::get('projects/delete/{id}','user\ProjectsController@delete');
    Route::get('projects','user\ProjectsController@index');

    //新闻投递
    Route::get('news','user\NewsController@index');
    Route::get('news/add','user\NewsController@add');
    Route::post('news/doadd','user\NewsController@doAdd');
    Route::get('news/modify/{id}','user\NewsController@modify');
    Route::post('news/domodify','user\NewsController@doModify');
    Route::get('news/delete/{id}','user\NewsController@delete');

    //友情链接管理
    Route::get('links/{id?}','user\LinksController@index');
    Route::post('links/doadd','user\LinksController@doAdd');
    Route::get('links/delete/{id}','user\LinksController@delete');

    //博客管理
    Route::get('blog','user\BlogController@index');
    Route::get('blog/addblog','user\BlogController@addBlog');
    Route::post('blog/doaddblog','user\BlogController@doAddBlog');
    Route::get('blog/Settings','user\BlogController@Settings');
    Route::get('blog/category/{id?}','user\BlogController@category');
    Route::post('blog/docategory','user\BlogController@doCategory');
    Route::get('blog/category/delete/{id}','user\BlogController@delCategory');
});

Route::controller('password', 'RemindersController');


//评论相关
Route::post('comment/post','publics\CommentController@post');